package domain

// 同步请求（对应 SyncRequest）
type SyncRequest struct {
	RequestId string
	Model     ModelSpec
	Messages  []Msg
	PromptKey string
	Variables map[string]string
}

type RoleType string
type EventType string

func (e EventType) ToString() string {
	return string(e)
}

type Msg struct {
	Role    RoleType
	Content string
}

type StreamEvent struct {
	Err     error
	Type    EventType
	Content string
	Usage   SyncResponseUsage
}

const (
	// ChatMessageTypeUser is a message sent by a human.
	ChatMessageTypeUser RoleType = "user"
	// ChatMessageTypeSystem is a message sent by the system.
	ChatMessageTypeSystem RoleType = "system"
)

const (
	ErrorStreamEvent   EventType = "error"
	MessageStreamEvent EventType = "message"
	EndStreamEvent     EventType = "end"
)

type SyncResponseUsage struct {
	PromptTokens     int32
	CompletionTokens int32
	TotalTokens      int32
}

type AsyncTask struct {
	TaskID string
	Req    AsyncRequest
	Status int32
	Resp   SyncResponse
	Ctime  int64
	Utime  int64
}
